#coding:utf-8
'''
create on 2017-09-01

@author:sandy
'''

from pycommon import Const
from pycommon import Pack as packet
import logging

def cmdKeepAlive(client,pkt):
    pass

def cmdLoginMgr(client,pkt):
    code = packet.unpack("H",pkt)
    if code == Const.ERR_OK:
        logging.debug(u"login->loginmgr sucess")
    else:
        logging.debug(u'login->loginmgr Fail code=%d',code)
    pass

__cmdTable = {
        Const.CMD_KEEP_ALIVE       : cmdKeepAlive,
        Const.CMD_LGM2LG_LOGIN     : cmdLoginMgr
    }

def parse(client,cmd,pkt):
    if cmd == Const.CMD_KEEP_ALIVE:
        return
    logging.debug(u"ClientParse cmd = %d",cmd)
    func = __cmdTable.get(cmd)
    if not func:
        logging.error(u"cmd = %d not found",cmd);
    func(client,pkt)

if __name__ == "__main__":
    pass